package com.ultra.template.content;

import com.ultra.annotation.Validator;
import com.ultra.constraint.Constraint;
import com.ultra.reflect.ReflectUtil;
import lombok.Data;

import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;

/**
 * @author hcUltra
 * @description 参数配置
 * @date 2024/4/23 07:14
 **/
@Data
public class AcvContext {
    public static Class<?> clazz = null;
    private Method validatorMethod = null;
    private Method correctMethod = null;
    private Integer testTimes;
    private final List<Argument> arguments;
    private Map<Pairs, Constraint> toBeEvaluatedConstraints;

    public AcvContext(List<Argument> arguments) {
        this.arguments = arguments;
        setCorrectMethod(ReflectUtil.reflectCorretAnnotationMethod());
        setValidatorMethod(ReflectUtil.reflectValidatorAnnotationMethod());
        Validator configAnnotation = clazz.getAnnotation(Validator.class);
        setTestTimes(configAnnotation.count());
    }
}